package com.yawn.zerodefect.controller;

import com.yawn.zerodefect.controller.entity.RestResponse;
import com.yawn.zerodefect.service.HistoricalService;
import com.yawn.zerodefect.util.WebUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/his")
public class HistoricalController {

    @Resource
    private HistoricalService historicalService;

    @GetMapping("/started")
    public RestResponse myStarted(HttpSession session, int first, int size) {
        return historicalService.myStarted(WebUtil.getUser(session), first, size);
    }

    @GetMapping("/finished")
    public RestResponse myFinished(HttpSession session, int first, int size) {
        return historicalService.myFinished(WebUtil.getUser(session), first, size);
    }

    @GetMapping("/list")
    public RestResponse listDefect(String proCode, int first, int size) {
        return historicalService.listDefect(proCode, first, size);
    }

}
